package com.xinzhi.util;



import static com.xinzhi.util.ConvertUtil.*;

public class GetFileFront {
    public String getFile(String path){
        String text=null;
//        String path="C:/Users/Administrator/Desktop/1.doc";
        int dotIndex = path.lastIndexOf(".");
        if (dotIndex<0){
            return "该文件没有后缀名";
        }
        String extension = path.substring(dotIndex + 1);
        if (extension.equals("doc")){
            text=readDoc(path);
        }else if (extension.equals("docx")){
            text=readDocx(path);
        }else if (extension.equals("pdf")){
            text=readPdf(path);
        }else{
            return "失败";

        }
        return text;
    }
}
